package short_semester.questionnaire_planet.response.AnalyseController;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import short_semester.questionnaire_planet.pojo.FillBlankQuestionRecord;
import short_semester.questionnaire_planet.pojo.Questionnaire;
import short_semester.questionnaire_planet.pojo.QuestionnaireRecord;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompletionResponse {
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    Date time;
    String text;
    String ip;
    String province;
    String city;
    public CompletionResponse(FillBlankQuestionRecord record){
        QuestionnaireRecord questionnaireRecord = record.getQuestionnaireRecord();
        time = questionnaireRecord.getSubmitDate();
        text = record.getAnswer();
        ip = questionnaireRecord.getIp();
        province = questionnaireRecord.getProvince();
        city = questionnaireRecord.getCity();
    }
}
